package com.ceshi.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.ceshi.meta.Trans;

public interface TransDao {
	
	@Select("select * from trx where contentId=${userid} and personId=${contentid}")
	public Trans getTransbyContentIdAndUserid(@Param(value="userid") int userid, @Param(value="contentid") int contentid);
	
	@Select("select * from trx where contentId=#{id}")
	public List<Trans> getTransbyContentId(int id);
	
	@Select("select * from trx where personId=#{id}")
	public List<Trans> getTransbyUserId(int id);
	
	@Insert("INSERT INTO trx (contentId,personId,price,time,buyNum)VALUES(#{contentId},#{personId},#{price},#{time},#{buyNum})")
	public void insertTrans(Trans trans);
}
